﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows;
using Xceed.Wpf.AvalonDock.Layout;
using PPP.ViewModel;
using PPP.ViewModel.WindowModel;

namespace PPP.Selector {
    /// <summary>
    /// Template selector to select right docking manager template. 
    /// 
    /// <list type="bullet">
    /// <item>
    /// <term>Author</term>
    /// <description>Sebastian Will</description>
    /// </item>
    /// </list>
    /// 
    /// </summary>
    class PanesTemplateSelector : DataTemplateSelector {

        #region Properties

        /// <summary>
        /// The FileView tempalte
        /// </summary>
        //public DataTemplate FileViewTemplate {
        //    get;
        //    set;
        //}

        /// <summary>
        /// The GalleryView tempalte
        /// </summary>
        public DataTemplate GalleryViewTemplate {
            get;
            set;
        }

        /// <summary>
        /// The PropertiesView tempalte
        /// </summary>
        public DataTemplate PropertiesViewTemplate {
            get;
            set;
        }

        /// <summary>
        /// The PreviewView tempalte
        /// </summary>
        public DataTemplate PreviewViewTemplate {
            get;
            set;
        }

        /// <summary>
        /// The USBView tempalte
        /// </summary>
        public DataTemplate USBViewTemplate {
            get;
            set;
        }
        
        #endregion

        #region Constructors

        /// <summary>
        /// Initializes a new instance of the PanesTemplateSelector class.
        /// </summary>
        public PanesTemplateSelector() {

        }

        #endregion

        #region Methods

        public override System.Windows.DataTemplate SelectTemplate(object item, System.Windows.DependencyObject container) {
            var itemAsLayoutContent = item as LayoutContent;

            //if (item is FileViewModel)
            //    return FileViewTemplate;

            if (item is GalleryViewModel)
                return GalleryViewTemplate;
            
            if (item is PropertiesViewModel)
                return PropertiesViewTemplate;

            if (item is PreviewViewModel)
                return PreviewViewTemplate;

            if (item is USBViewModel)
                return USBViewTemplate;

            return base.SelectTemplate(item, container);
        }

        #endregion
    }
}
